]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionPrefs: Fix opening extension preferences on startup
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 28 Feb 2013 13:50:56 +0000 (14:50 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 28 Feb 2013 14:37:29 +0000 (15:37 +0100)
gnome-shell-extension-prefs supports opening a specific extension's
preferences directly from the command line by passing the UUID.
However this broke when extension loading was changed to be processed
asynchronously, as no extension has been loaded when the command
line argument is processed. Fix by deferring opening the extension's
preferences until all extensions have been loaded.

https://bugzilla.gnome.org/show_bug.cgi?id=694858

js/extensionPrefs/main.js

index 53a6966e5af627498c4e73baebae57108fdaec2c..683fcc36f4216bec2001bdf3f1c652c168d97aaf 100644 (file)
@@ -45,6 +45,7 @@ const Application = new Lang.Class({
         this._extensionPrefsModules = {};
 
         this._extensionIters = {};
+        this._startupUuid = null;
     },
 
     _buildModel: function() {
@@ -203,6 +204,7 @@ const Application = new Lang.Class({
     _scanExtensions: function() {
         let finder = new ExtensionUtils.ExtensionFinder();
         finder.connect('extension-found', Lang.bind(this, this._extensionFound));
+        finder.connect('extensions-loaded', Lang.bind(this, this._extensionsLoaded));
         finder.scanExtensions();
     },
 
@@ -212,6 +214,11 @@ const Application = new Lang.Class({
         this._extensionIters[extension.uuid] = iter;
     },
 
+    _extensionsLoaded: function() {
+        if (this._startupUuid && this._extensionAvailable(this._startupUuid))
+            this._selectExtension(this._startupUuid);
+        this._startupUuid = null;
+    },
 
     _onActivate: function() {
         this._window.present();
@@ -232,10 +239,10 @@ const Application = new Lang.Class({
             // Strip off "extension:///" prefix which fakes a URI, if it exists
             uuid = stripPrefix(uuid, "extension:///");
 
-            if (!this._extensionAvailable(uuid))
-                return 1;
-
-            this._selectExtension(uuid);
+            if (this._extensionAvailable(uuid))
+                this._selectExtension(uuid);
+            else
+                this._startupUuid = uuid;
         }
         return 0;
     }